{% extends "base.html" %}
{% block content %}
<div class="card">
  <h2>编辑银行卡</h2>
  <form method="POST">
    <div class="form-group">
      <label>卡号</label>
      <input type="text" name="cardID" value="{{ card.cardID }}" readonly>
    </div>

    <div class="form-group">
      <label>存款类型</label>
      <input type="text" name="type" value="{{ card.type }}" required>
    </div>

    <div class="form-group">
      <label>开户日期</label>
      <input type="date" name="openDate" value="{{ card.openDate }}" required>
    </div>

    <div class="form-group">
      <label>开户金额</label>
      <input type="number" name="initAmount" value="{{ card.initAmount }}" step="0.01" required>
    </div>

    <div class="form-group">
      <label>当前余额</label>
      <input type="number" name="balance" value="{{ card.balance }}" step="0.01" required>
    </div>

    <div class="form-group">
      <label>密码</label>
      <input type="text" name="password" value="{{ card.password }}" required>
    </div>

    <div class="form-group">
      <label>是否挂失</label>
      <input type="checkbox" name="lost" {% if card.lost %}checked{% endif %}>
    </div>

    <div class="form-group">
      <label>所属客户编号</label>
      <select name="customerID" required>
        {% for c in customers %}
        <option value="{{ c.customerID }}"
          {% if card.customerID == c.customerID %}selected{% endif %}>
          {{ c.customerID }} - {{ c.customerName }}
        </option>
        {% endfor %}
      </select>
    </div>

    <button type="submit" class="btn">保存修改</button>
    <a href="{{ url_for('cards') }}" class="btn">返回</a>
  </form>
</div>
{% endblock %}
